<template>
  <view class="page-container">
    <scroll-view class="content" scroll-y>
      <!-- 用户信息 -->
      <view class="user-info-card">
        <image src="/static/icons/ava.png" class="avatar" />
        <view class="user-details">
          <view class="username-row">
            <text class="username">微信用户</text>
            <view class="user-tag">普通用户</view>
            <text class="user-id">46785658</text>
          </view>
          <text class="welcome">欢迎使用~</text>
        </view>
      </view>
      
      <!-- 功能图标 -->
      <view class="function-icons">
        <view class="icon-item">
          <view class="icon-bg tutorial-bg">
            <image src="/static/icons/teach.png" class="custom-icon" />
          </view>
          <text class="icon-text">使用教程</text>
        </view>
        <view class="icon-item">
          <view class="icon-bg service-bg">
            <image src="/static/icons/contact.png" class="custom-icon" />
          </view>
          <text class="icon-text">客服微信</text>
        </view>
        <view class="icon-item">
          <view class="icon-bg support-bg">
            <image src="/static/icons/support.png" class="custom-icon" />
          </view>
          <text class="icon-text">支持作者</text>
        </view>
      </view>
    </scroll-view>
  </view>
</template>

<script>
export default {
  methods: {
    switchTab(tabName) {
      if (tabName === 'index') {
        uni.switchTab({ url: '/pages/index/index' })
      } else if (tabName === 'task') {
        uni.switchTab({ url: '/pages/task/task' })
      }
    }
  }
}
</script>

<style scoped>
.page-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #f5f5f5;
}

.content {
  flex: 1;
  padding: 15px;
  box-sizing: border-box;
  overflow: hidden;
}

.user-info-card {
  display: flex;
  align-items: center;
  background-color: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  width: 100%;
  box-sizing: border-box;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  margin-right: 15px;
  background-color: #f0f0f0;
}

.user-details {
  flex: 1;
}

.username-row {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.username {
  font-weight: bold;
  font-size: 18px;
  color: #333;
  margin-right: 10px;
}

.user-tag {
  background-color: #E3F2FD;
  color: #1976D2;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  margin-right: 10px;
}

.user-id {
  font-size: 14px;
  color: #999;
  background-color: #f5f5f5;
  padding: 4px 10px;
  border-radius: 10px;
  display: inline-block;
}

.welcome {
  font-size: 14px;
  color: #666;
}

.function-icons {
  display: flex;
  justify-content: space-between;
  background-color: white;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  width: 100%;
  box-sizing: border-box;
}

.icon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 30%;
}

.icon-bg {
  width: 48px;
  height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 16px;
  margin-bottom: 6px;
}

.tutorial-bg {
  background-color: #E3F2FD;
}

.service-bg {
  background-color: #FFF3E0;
}

.support-bg {
  background-color: #E8EAF6;
}

.custom-icon {
  width: 24px;
  height: 24px;
}

.icon-text {
  font-size: 13px;
  color: #333;
}

.tab-bar {
  display: flex;
  border-top: 1px solid #eee;
  background-color: white;
  padding: 5px 0;
  width: 100%;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
}

.tab-item.active {
  color: #2979FF;
}

.tab-item text {
  font-size: 12px;
  margin-top: 5px;
}
</style>